package com.my.kq.dao;

import com.my.kq.entity.Attendance;
import com.my.kq.uitl.BaseDAO;

import java.util.List;

public class attendanceDao extends BaseDAO {
    public List<Attendance> attList(Integer number) throws Exception {
        String sql="select * from attendance where employeeNumber=?";
        Object[]obj={number};
        List<Attendance> list = getList(sql, new Attendance(), obj);
        return list;
    }

    public int attenadd(Integer number, String day, String timeType, String startTime, String starTime) throws Exception {
        String sql="insert into attendance values(null,?,?,?,?,?,null,null,null,null)";
        Object[]obj={number,day,timeType,startTime,starTime};
        int i = addOrupdOrdel(sql, obj);

        return i;
    }

    public void attenaddxb(Integer id, String startTime, String starTime) throws Exception {
        String sql="update attendance set endTime=?,endType=? where id=?";
       // String sql="insert into attendance(id,endTime,endType) values(?,?,?)";
        Object[]obj={startTime,starTime,id};
       addOrupdOrdel(sql,obj);

    }

    public Attendance attcx(Integer number, String day) throws Exception {
        String sql="select * from attendance where employeeNumber=? and day=?";
        Object[]obj={number,day};
        Attendance one = getOne(sql, new Attendance(), obj);
        return one;
    }
}
